package com.itheima.d3_arraylist;

import java.util.ArrayList;

public class ArrayListDemo1 {
    public static void main(String[] args) {
        //创建一个集合 集合名字是list
        ArrayList <String> list = new ArrayList<>();
        System.out.println( list);
        //往集合里面添加数据
        list.add("陈平安");
        list.add("齐静春");
        list.add("李宝瓶");
        list.add("宁姚");
        System.out.println(list);
        System.out.println("====================");
        //集合里面删除数据
        list.remove("宁姚");
        System.out.println(list);
        list.remove(2);
        System.out.println( list);
        //集合里面修改数据
        list.set(0,"崔巉");
        System.out.println(list);
        //集合遍历
        for(int i = 0; i < list.size(); i++){
            String people = list.get(i);
            System.out.println(people);
        }
    }
}
